<?php
namespace app\weixin\controller;


use app\common\services\WeixinService;
use think\Controller;

class Weixin extends Controller
{
    /**
     * @var WeixinService
     */
    private $_service;

    protected function _initialize()
    {
        $this->_service = new WeixinService();
    }

    public function index()
    {
        if (isset($_GET['echostr'])) {
            if ($this->_service->checkSignature()) {
                return $_GET['echostr'];
            }
        }
        $this->_service->dispatch();
    }

}
